import { Graph } from "@antv/x6";

import StartEvent from './StartEvent';
import EndEvent from './EndEvent';
import UserTask from './UserTask';
import ServiceTask from './ServiceTask';
import ExclusiveGateway from './ExclusiveGateway';
import ParallelGateway from './ParallelGateway';
import InclusiveGateway from './InclusiveGateway';
import SequenceFlow from './SequenceFlow';

enum BpmnElements{
  StartEvent = 'StartEvent',
  EndEvent = 'EndEvent',
  UserTask = 'UserTask',
  ServiceTask = 'ServiceTask',
  ExclusiveGateway = 'ExclusiveGateway',
  ParallelGateway = 'ParallelGateway',
  InclusiveGateway = 'InclusiveGateway',
  SequenceFlow = 'SequenceFlow',
}

const BpmnShapeNames:any = {
  Process: '流程定义',
  StartEvent: '开始事件',
  EndEvent: '结束事件',
  UserTask: '用户任务',
  ServiceTask: '服务任务',
  ExclusiveGateway: '排他网关',
  ParallelGateway: '并行网关',
  InclusiveGateway: '包容网关',
  SequenceFlow: '流转路径',
}

const BpmnShapeTags:any = {
  Process: 'process',
  StartEvent: 'startEvent',
  EndEvent: 'endEvent',
  UserTask: 'userTask',
  ServiceTask: 'serviceTask',
  ExclusiveGateway: 'exclusiveGateway',
  ParallelGateway: 'parallelGateway',
  InclusiveGateway: 'inclusiveGateway',
  SequenceFlow: 'sequenceFlow',
}

const BpmnTagShapes:any = {
  process: 'Process',
  startEvent: 'StartEvent',
  endEvent: 'EndEvent',
  userTask: 'UserTask',
  serviceTask: 'ServiceTask',
  exclusiveGateway: 'ExclusiveGateway',
  parallelGateway: 'ParallelGateway',
  inclusiveGateway: 'InclusiveGateway',
  sequenceFlow: 'SequenceFlow',
}

const registerElements=()=>{
  Graph.registerNode('StartEvent',StartEvent);
  Graph.registerNode('EndEvent',EndEvent);
  Graph.registerNode('UserTask',UserTask);
  Graph.registerNode('ServiceTask',ServiceTask);
  Graph.registerNode('ExclusiveGateway',ExclusiveGateway);
  Graph.registerNode('ParallelGateway',ParallelGateway);
  Graph.registerNode('InclusiveGateway',InclusiveGateway);
  Graph.registerEdge('SequenceFlow',SequenceFlow);
}

export {
  StartEvent,
  EndEvent,
  UserTask,
  ServiceTask,
  ExclusiveGateway,
  ParallelGateway,
  InclusiveGateway,
  SequenceFlow,
  BpmnElements,
  BpmnShapeNames,
  BpmnShapeTags,
  BpmnTagShapes,
  registerElements
};